package cms.manage.template.value.impl;

import cms.bean.links.Links;
import cms.bean.template.Forum;
import cms.manage.template.impl.LinksTemplateManage;
import cms.manage.template.value.TplValueStrategy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

import static cms.common.SystemConstant.DisplayType.DISPLAY_COLLECTION;

@Service("友情链接")
public class LinksStrategy implements TplValueStrategy<List<Links>> {
    @Resource
    LinksTemplateManage linksTemplateManage;// 友情链接 -- 模板方法实现

    @Override
    public List<Links> doOperation(Forum forum, Map<String, Object> submitParameter, Map<String, Object> runtimeParameter) {
        if(forum.getForumChildType().equals("友情链接列表")){
            if(forum.getDisplayType().equals(DISPLAY_COLLECTION.getValue())){//集合
                List<Links> value = linksTemplateManage.linksCollection(forum, submitParameter,runtimeParameter);
                return value;
            }
        }
        return null;
    }
}
